clear all
set more off
cd ""

use "sample.dta", clear

tab rel_time, gen(rel_w)
forvalue i = 1/31 {
gen rel_w`i'_D = rel_w`i' * faction
}

gen rel_w11_D_21 = rel_w11_D*21
forvalue i = 12/31 {
gen diff_Drel`i'_11 = rel_w`i'_D - rel_w11_D
}

* Generate binary outcomes

foreach i in 0 5 10 15 {
gen confn14_`i' = confn14 > `i' if !mi(confn14)
}

reghdfe confn14_0 rel_w11_D_21 diff_Drel* treat_csm wdsp temp prcp, absorb(i.city_code#i.faction i.time#i.faction i.prov_code#c.time#i.faction) cluster(time)

reghdfe confn14_5 rel_w11_D_21 diff_Drel* treat_csm wdsp temp prcp, absorb(i.city_code#i.faction i.time#i.faction i.prov_code#c.time#i.faction) cluster(time)

reghdfe confn14_10 rel_w11_D_21 diff_Drel* treat_csm wdsp temp prcp, absorb(i.city_code#i.faction i.time#i.faction i.prov_code#c.time#i.faction) cluster(time)

reghdfe confn14_15 rel_w11_D_21 diff_Drel* treat_csm wdsp temp prcp, absorb(i.city_code#i.faction i.time#i.faction i.prov_code#c.time#i.faction) cluster(time)
